package com.ddyx.rest;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ddyx.service.IndexService;
import com.ddyx.service.StoreActivityService;
import com.ddyx.util.RequestForm;
import com.ddyx.util.ResponseForm;

@Controller
@RequestMapping("/index")
public class IndexController {

	@Resource
	IndexService indexService;
	
	
	/**
	 * 首页
	 */
	@ResponseBody
	@RequestMapping(method = RequestMethod.POST)
	public ResponseForm getActivitysByParams(@RequestBody RequestForm param) {
		//Map<String, Object> paramMap = (Map<String, Object>) param.getData();
		return indexService.getData(param);
	}
	

	/**
	 * 新款上架
	 */
	@ResponseBody
	@RequestMapping(value = "/new" ,method = RequestMethod.POST)
	public ResponseForm getNewActivityList(@RequestBody RequestForm param) {
		//Map<String, Object> paramMap = (Map<String, Object>) param.getData();
		return indexService.getNewActivityList(param);
	}
	
	
	/**
	 * 支付版-获取首页最新商品信息
	 * @param ResponseForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/v1.5/newGoodsList" ,method = RequestMethod.POST)
	public ResponseForm getNewGoodsList(@RequestBody RequestForm param) {
		return indexService.getNewGoodsList(param);
	}
	/**
	 * 支付版-获取首页头图信息
	 * @param ResponseForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/v1.5/headerPic" ,method = RequestMethod.POST)
	public ResponseForm getHeaderPic(@RequestBody RequestForm param) {
		return indexService.getHeaderPic(param);
	}
	
	/**
	 * 支付版-获取折扣商品信息
	 * @param ResponseForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/v1.5/discountGoods" ,method = RequestMethod.POST)
	public ResponseForm getDiscountGoods(@RequestBody RequestForm param) {
		return indexService.getDiscountGoods(param);
	}
	
	/**
	 * 支付版-获取导购信息
	 * @param ResponseForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/v1.5/employe" ,method = RequestMethod.POST)
	public ResponseForm getIndexEmploye(@RequestBody RequestForm param) {
		return indexService.getIndexEmploye(param);
	}
	
	/**
	 * 支付版-商品搜索
	 * @param ResponseForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/v1.5/search" ,method = RequestMethod.POST)
	public ResponseForm search(@RequestBody RequestForm param) {
		return indexService.search(param);
	}
}
